home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Systemmonitors
/
RSys
/
RSysSrc.lha
/
RSysError.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-25
|
3KB
|
148 lines
/*
***************************************************************************
*
* Datei:
* RSysError.c
*
* Inhalt:
*
* --- Globale Routinen ---
*
* void ErrorHandleFull ( char *ObjName , enum err_objects errobj , enum err_actions erract , int kill , char *file , char *func , int line );
*
* --- Lokale Routinen ---
*
*
* Bemerkungen:
* Enthält die Fehlerbehandlungsroutinen für RSys. Es werden der
* Quelldateiname, die Funktion und die entsprechende
* Zeilennummer unterstützt.
*
* Erstellungsdatum:
* 20-Apr-93 Rolf Böhme
*
* Änderungen:
* 20-Apr-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSys.h"
char *str_err_objects[] = {
"Broker",
"Ports",
"Files and Directories",
"Screens",
"Windows",
"Libraries",
"Devices",
"Icons",
"Gadgets",
"Menus",
"Environment and Prefs",
"DOS-ExAll()",
"Fonts",
"Lists and Nodes",
"Memory",
"Tasks",
"Clipboard",
"Own object",
"Data entry",
"Object context creation",
"Miscellaneous"
};
char *str_err_actions[] = {
"Duplicate name attempted",
"Creation failed",
"Can't find object",
"Can't kill object",
"Can't open object",
"Can't read file",
"Can't write file",
"ExAll() failed",
"Size of object to large",
"Object not saved",
"Wrong input or argument given",
"Can't examine object info",
"Object does no exist",
"Object has wrong type",
"Allocation failed",
"Can't modify this object",
"Locking failed"
};
extern long maxentries;
/*
* ErrorHandleFull() gibt im Falle eines Fehlers eine
* vollständige Beschreibung des Fehlers unter Angabe der
* Zeilennummer und der Quelldatei sowie der Funktion, in der
* der Fehler auftrat
*/
void
ErrorHandleFull(char *ObjName, enum err_objects errobj, enum err_actions erract,
int kill, char *file, char *func, int line)
{
long ioerr;
UBYTE header[BUFSIZE],
kind[BUFSIZE],
iofault[BUFSIZE];
UBYTE *errfmt = (UBYTE *)"Error object : %s\n"
"Error type : %s\n"
"Error action : %s\n"
"I/O-Error : %ld (%s)\n"
"Source file : %s\n"
"Function : %s()\n"
"Source line : %ld\n"
"-- %s";
DPOS;
sprintf((char *)header, "%s %s message", NAME, (kill ? "Error" : "Info"));
strcpy((char *)kind, (kill == KILL) ? "Sorry...this killed the Program!" :
"Don't worry! The program continues...");
ioerr = IoErr();
if(!Fault(ioerr, (STRPTR)"is", iofault, (long)(BUFSIZE-1)))
strcpy((char *)iofault, field[NO_FIELD]);
if(ioerr != 0L) SetIoErr(0L);
if (IntuitionBase)
{
DisplayBeep(NULL);
MyEasyRequest(SysWnd, header,
(UBYTE *)((kill == KILL) ? "Kill!" : "Continue"),
errfmt,
(UBYTE *) ObjName,
(UBYTE *) str_err_objects[errobj],
(UBYTE *) str_err_actions[erract],
ioerr, iofault,
(UBYTE *) file,
(UBYTE *) func,
line,
kind);
}
else if (NOT(Flags.wb_start))
{
strcat((char *)kind, "\n");
Printf(errfmt,(ULONG) ObjName,
str_err_objects[errobj],
(UBYTE *) str_err_actions[erract],
ioerr, iofault,
(UBYTE *) file,
(UBYTE *) func,
line,
kind);
}
if (kill == KILL) CloseAll();
return;
}